//---------------------------------------------------------------------------

#ifndef uSelPrinterH
#define uSelPrinterH
//---------------------------------------------------------------------------
#include <registry.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "CEdit.h"
#include "CEditNum.h"
#include "CGBox.h"
#include <Graphics.hpp>
#include <ExtCtrls.hpp>
#include <ImgList.hpp>
#include <Buttons.hpp>
#include <Dialogs.hpp>
#include <ComCtrls.hpp>
#include "CBitBtn.h"

#define Str_MauvaisChemin "·$·"
#define Str_MauvaisCriteres "·$·,·$·"
//#include <Printers.hpp>
//---------------------------------------------------------------------------
class TSelPrinter : public TForm
{
    typedef inherited TForm;
__published:	// Composants gérés par l'EDI
    TComboBox *cbPrinter;
    TButton *btPropriete;
    TLabel *lblEtat;
    TLabel *lblEmplacement;
    TLabel *lblCommentaire;
    TRadioButton *rbTout;
    TRadioButton *rbPageCourante;
    TRadioButton *rbPages;
    CEditNum *enDe;
  TLabel *lblaLaPage;
    CEditNum *enA;
    TGroupBox *gpbBox1;
    TLabel *lblType;
    CBitBtn *btnOK;
    CBitBtn *btnCancel;
  CGroupBox *gpbCopies;
  TImage *ImNonAssemblees;
  TImage *ImAssemblees;
  TLabel *lblAssembleeUnsupported;
  CEditNum *enCopies;
  TCheckBox *cbAssemblee;
  TUpDown *udCopies;
  TLabel *lblDe;
  TGroupBox *GroupBox1;
  CEditNum *edZoom;
  TUpDown *UpDown1;
  TCheckBox *cbPaysagePortraitAssembles;
    TBitBtn *btnGEDManu;
  TLabel *lblDeLaPage;
    TBitBtn *btnGEDAuto;
    void __fastcall cbPrinterChange(TObject *Sender);
    void __fastcall btProprieteClick(TObject *Sender);
    void __fastcall rbToutClick(TObject *Sender);
    void __fastcall enCopiesChange(TObject *Sender);
    void __fastcall cbAssembleeClick(TObject *Sender);
    void __fastcall enDeChange(TObject *Sender);
    void __fastcall enAChange(TObject *Sender);
    void __fastcall udCopiesChangingEx(TObject *Sender, bool &AllowChange,
          short NewValue, TUpDownDirection Direction);
    void __fastcall btnOKClick(TObject *Sender);
    void __fastcall btnCancelClick(TObject *Sender);
  void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
  void __fastcall btnGEDManuClick(TObject *Sender);
  void __fastcall edZoomChange(TObject *Sender);
    void __fastcall btnGEDAutoClick(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:	// Déclarations utilisateur
    TRegistry *m_Reg;
    TPrintDialogOptions m_FOptions;
    char                m_ADevice[255], m_ADriver[255], m_APort[255];
    AnsiString          m_asNomDoc ,m_asArboGED;
    DEVMODE             *m_pDevMode;
    HGLOBAL             m_hDeviceMode;
    int                 _choixDeClassementDuDocumentPrecedent;
    void        __fastcall FreeDevMode(int freeAll=true);
    void        __fastcall Init();
    void        __fastcall Refresh();

    TPrintRange __fastcall GetPrintRange( );
    void        __fastcall SetPrintRange( TPrintRange p);
    int         __fastcall GetFromPage( );
    void        __fastcall SetFromPage( int i);
    int         __fastcall GetToPage( );
    void        __fastcall SetToPage( int i);
    int         __fastcall GetMinPage( );
    void        __fastcall SetMinPage( int i);
    int         __fastcall GetMaxPage( );
    void        __fastcall SetMaxPage( int i);
    AnsiString  __fastcall GetDocName( );
    void        __fastcall SetDocName( const AnsiString &s);
    bool        __fastcall GetCollate( );
    void        __fastcall SetCollate( bool i);
    int         __fastcall GetCopies( );
    void        __fastcall SetCopies( int i);
    bool        __fastcall GetCopiesShow( );
    void        __fastcall SetCopiesShow( bool i);
public:		// Déclarations utilisateur

    bool bPDF,bGEDTmp,bPrintTmp,bSepareImpGroupe,bClassManuel,bClassementAuDocumentCourant,bChoixOrigineAuto;
    AnsiString CheminDoc;
    Variant vGedEIC;
    int nbDocAImprimer;

    __fastcall TSelPrinter(TComponent* Owner);
    virtual __fastcall ~TSelPrinter();

    void __fastcall ActiveClassAuto(bool bActive);
    int __fastcall ShowModal(void);

    __property TPrintRange PrintRange={read=GetPrintRange, write=SetPrintRange};
    __property int         FromPage  ={read=GetFromPage,   write=SetFromPage};
    __property int         ToPage    ={read=GetToPage,     write=SetToPage};
    __property int         MinPage   ={read=GetMinPage,    write=SetMinPage};
    __property int         MaxPage   ={read=GetMaxPage,    write=SetMaxPage};
    __property AnsiString  DocName   ={read=GetDocName,    write=SetDocName};
    __property bool        Collate   ={read=GetCollate,    write=SetCollate};
    __property int         Copies    ={read=GetCopies,     write=SetCopies};
    __property bool        CopiesShow={read=GetCopiesShow, write=SetCopiesShow};
    __property TPrintDialogOptions Options = {read=m_FOptions, write=m_FOptions};
    __property AnsiString  asArboGED = { read=m_asArboGED,write=m_asArboGED};
    __property AnsiString  asNomDoc  = { read=m_asNomDoc,write=m_asNomDoc};

};
//---------------------------------------------------------------------------
extern TSelPrinter *SelPrinter;
//---------------------------------------------------------------------------
#endif
